<!--
 * @Author: xiaxia
 * @Description: 
 * @Date: 2024-05-09 10:15:01
 * @LastEditTime: 2024-05-29 16:16:15
 * @FilePath: \vue-admin-template\src\views\table\printTable\index.vue
-->
<template>
  <div class="app-container">
    <el-button type="primary"  v-print="printAre">打印</el-button>
    <div id="printAre">
      <el-table
        :data="tableData"
        style="width: 100%;margin-bottom: 20px;"
        row-key="id"
      >
        <el-table-column type="index" width="50" />
        <el-table-column prop="codeInvoice" label="发票代码" width="120" />
        <el-table-column prop="numInvoice" label="发票号码" width="180" />
        <el-table-column prop="tpyeInvioce" label="发票类型" width="105" :formatter="getRowType"/>
        <el-table-column prop="unAmount" label="未税金额" width="110" align="right"/>
        <el-table-column prop="taxAm" label="税额" width="100" align="right"/>
        <el-table-column prop="inAmount" label="含税金额" width="110" align="right"/>
        <el-table-column prop="kpDate" label="开票日期" width="100"/>
        <el-table-column prop="custName" label="购方名称" show-overflow-tooltip>
          {{'日月重工股份有限公司'}}
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 打印设置
      printAre: {
        id: "printAre",
        popTitle: "页眉部分",
        extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
      },
      tableData: this.$store.state.invioceLists,
      tagType: this.$store.state.tagType,
      tagEffect: this.$store.state.tagEffect,
      tpyeInvioceAll: this.$store.state.tpyeInvioceAll, // 发票类型
    }
  },
  created() {},
  methods: {
    // 转换发票类型
    getRowType (row, column) {
      let result = ''
      let val = row[column.property]
      let arr = this._data[column.property + 'All']
      for (let item of arr) {
        console.log(item.value == val);
        if (item.value == val) {
          result = item.label
          break
        }
      }
      return result
    },
  }
}
</script>
